package com.web.music.portal.mvc;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.web.music.interfaces.PersonService;
import com.web.music.interfaces.SecurityController;
import com.web.music.model.Person;

public class ListAllPersonController implements Controller {

	private PersonService personService;
	private SecurityController securityController;
	
	public PersonService getPersonService() {
		return personService;
	}

	public void setPersonService(PersonService personService) {
		this.personService = personService;
	}

	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) 
	throws Exception 
	{
		List<Person> people = personService.findAll();
		securityController.updateSecurityStatus(request, people);		
		return new ModelAndView("person_listall", "list", people);
	}
	public SecurityController getSecurityController() {
		return securityController;
	}

	public void setSecurityController(
			SecurityController securityController) {
		this.securityController = securityController;
	}	
}